package com.sleep.model;

import javax.persistence.*;
import java.sql.Date;

/**
 * Created by fadinglan on 2017/4/10.
 */
@Entity
@Table(name = "sleep_result", schema = "teenagers_monitor", catalog = "")
public class SleepResultEntity {
    private int iSleepResultId;
    private String vcDeviceId;
    private Integer iSleepEffciency;
    private Date tSleepDate;
    private Date tFallAsleepTime;
    private Date tWakeTime;
    private Date tStartSleep;
    private Date tEndSleep;
    private Byte tiSleepFlag;
    private Integer iSleepDuration;
    private Integer iLightDuration;
    private Integer iWakeDuration;
    private Integer iSleepMove;
    private Integer iSleepLeave;
    private String mtSleepStage;

    @Id
    @Column(name = "i_sleep_result_id", nullable = false)
    public int getiSleepResultId() {
        return iSleepResultId;
    }

    public void setiSleepResultId(int iSleepResultId) {
        this.iSleepResultId = iSleepResultId;
    }

    @Basic
    @Column(name = "vc_device_id", nullable = false, length = 20)
    public String getVcDeviceId() {
        return vcDeviceId;
    }

    public void setVcDeviceId(String vcDeviceId) {
        this.vcDeviceId = vcDeviceId;
    }

    @Basic
    @Column(name = "i_sleep_effciency", nullable = true)
    public Integer getiSleepEffciency() {
        return iSleepEffciency;
    }

    public void setiSleepEffciency(Integer iSleepEffciency) {
        this.iSleepEffciency = iSleepEffciency;
    }

    @Basic
    @Column(name = "t_sleep_date", nullable = true)
    public Date gettSleepDate() {
        return tSleepDate;
    }

    public void settSleepDate(Date tSleepDate) {
        this.tSleepDate = tSleepDate;
    }

    @Basic
    @Column(name = "t_fall_asleep_time", nullable = true)
    public Date gettFallAsleepTime() {
        return tFallAsleepTime;
    }

    public void settFallAsleepTime(Date tFallAsleepTime) {
        this.tFallAsleepTime = tFallAsleepTime;
    }

    @Basic
    @Column(name = "t_wake_time", nullable = true)
    public Date gettWakeTime() {
        return tWakeTime;
    }

    public void settWakeTime(Date tWakeTime) {
        this.tWakeTime = tWakeTime;
    }

    @Basic
    @Column(name = "t_start_sleep", nullable = true)
    public Date gettStartSleep() {
        return tStartSleep;
    }

    public void settStartSleep(Date tStartSleep) {
        this.tStartSleep = tStartSleep;
    }

    @Basic
    @Column(name = "t_end_sleep", nullable = true)
    public Date gettEndSleep() {
        return tEndSleep;
    }

    public void settEndSleep(Date tEndSleep) {
        this.tEndSleep = tEndSleep;
    }

    @Basic
    @Column(name = "ti_sleep_flag", nullable = true)
    public Byte getTiSleepFlag() {
        return tiSleepFlag;
    }

    public void setTiSleepFlag(Byte tiSleepFlag) {
        this.tiSleepFlag = tiSleepFlag;
    }

    @Basic
    @Column(name = "i_sleep_duration", nullable = true)
    public Integer getiSleepDuration() {
        return iSleepDuration;
    }

    public void setiSleepDuration(Integer iSleepDuration) {
        this.iSleepDuration = iSleepDuration;
    }

    @Basic
    @Column(name = "i_light_duration", nullable = true)
    public Integer getiLightDuration() {
        return iLightDuration;
    }

    public void setiLightDuration(Integer iLightDuration) {
        this.iLightDuration = iLightDuration;
    }

    @Basic
    @Column(name = "i_wake_duration", nullable = true)
    public Integer getiWakeDuration() {
        return iWakeDuration;
    }

    public void setiWakeDuration(Integer iWakeDuration) {
        this.iWakeDuration = iWakeDuration;
    }

    @Basic
    @Column(name = "i_sleep_move", nullable = true)
    public Integer getiSleepMove() {
        return iSleepMove;
    }

    public void setiSleepMove(Integer iSleepMove) {
        this.iSleepMove = iSleepMove;
    }

    @Basic
    @Column(name = "i_sleep_leave", nullable = true)
    public Integer getiSleepLeave() {
        return iSleepLeave;
    }

    public void setiSleepLeave(Integer iSleepLeave) {
        this.iSleepLeave = iSleepLeave;
    }

    @Basic
    @Column(name = "mt_sleep_stage", nullable = true, length = -1)
    public String getMtSleepStage() {
        return mtSleepStage;
    }

    public void setMtSleepStage(String mtSleepStage) {
        this.mtSleepStage = mtSleepStage;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SleepResultEntity that = (SleepResultEntity) o;

        if (iSleepResultId != that.iSleepResultId) return false;
        if (vcDeviceId != null ? !vcDeviceId.equals(that.vcDeviceId) : that.vcDeviceId != null) return false;
        if (iSleepEffciency != null ? !iSleepEffciency.equals(that.iSleepEffciency) : that.iSleepEffciency != null)
            return false;
        if (tSleepDate != null ? !tSleepDate.equals(that.tSleepDate) : that.tSleepDate != null) return false;
        if (tFallAsleepTime != null ? !tFallAsleepTime.equals(that.tFallAsleepTime) : that.tFallAsleepTime != null)
            return false;
        if (tWakeTime != null ? !tWakeTime.equals(that.tWakeTime) : that.tWakeTime != null) return false;
        if (tStartSleep != null ? !tStartSleep.equals(that.tStartSleep) : that.tStartSleep != null) return false;
        if (tEndSleep != null ? !tEndSleep.equals(that.tEndSleep) : that.tEndSleep != null) return false;
        if (tiSleepFlag != null ? !tiSleepFlag.equals(that.tiSleepFlag) : that.tiSleepFlag != null) return false;
        if (iSleepDuration != null ? !iSleepDuration.equals(that.iSleepDuration) : that.iSleepDuration != null)
            return false;
        if (iLightDuration != null ? !iLightDuration.equals(that.iLightDuration) : that.iLightDuration != null)
            return false;
        if (iWakeDuration != null ? !iWakeDuration.equals(that.iWakeDuration) : that.iWakeDuration != null)
            return false;
        if (iSleepMove != null ? !iSleepMove.equals(that.iSleepMove) : that.iSleepMove != null) return false;
        if (iSleepLeave != null ? !iSleepLeave.equals(that.iSleepLeave) : that.iSleepLeave != null) return false;
        if (mtSleepStage != null ? !mtSleepStage.equals(that.mtSleepStage) : that.mtSleepStage != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = iSleepResultId;
        result = 31 * result + (vcDeviceId != null ? vcDeviceId.hashCode() : 0);
        result = 31 * result + (iSleepEffciency != null ? iSleepEffciency.hashCode() : 0);
        result = 31 * result + (tSleepDate != null ? tSleepDate.hashCode() : 0);
        result = 31 * result + (tFallAsleepTime != null ? tFallAsleepTime.hashCode() : 0);
        result = 31 * result + (tWakeTime != null ? tWakeTime.hashCode() : 0);
        result = 31 * result + (tStartSleep != null ? tStartSleep.hashCode() : 0);
        result = 31 * result + (tEndSleep != null ? tEndSleep.hashCode() : 0);
        result = 31 * result + (tiSleepFlag != null ? tiSleepFlag.hashCode() : 0);
        result = 31 * result + (iSleepDuration != null ? iSleepDuration.hashCode() : 0);
        result = 31 * result + (iLightDuration != null ? iLightDuration.hashCode() : 0);
        result = 31 * result + (iWakeDuration != null ? iWakeDuration.hashCode() : 0);
        result = 31 * result + (iSleepMove != null ? iSleepMove.hashCode() : 0);
        result = 31 * result + (iSleepLeave != null ? iSleepLeave.hashCode() : 0);
        result = 31 * result + (mtSleepStage != null ? mtSleepStage.hashCode() : 0);
        return result;
    }
}
